package com.websocet.task;

import com.websocet.service.SseEmitterService;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author: 陈玉鹏
 * @Description: TODO
 * @DateTime: 2023/5/30 22:01
 */
@Component
public class SseSchedule {

    @Autowired
    SseEmitterService sseEmitterService;

    @SneakyThrows
    public void test() {
        Thread.sleep(2000);
        sseEmitterService.sendMessageToOneClient("123", "测试测试");
        sseEmitterService.closeConnect("123");
    }
}
